#ifndef FORM_H
#define FORM_H

#include <QtGui>
#include <QWidget>
#include "cv.h"
#include "CentralCanvasBase.h"
class CPaintCanvas :
	public OCEANUI::CCentralCanvasBase
{
 

public:
	CPaintCanvas(OCEANUI::CMainWindowBase* parent = 0);
	enum ShapeType {
		Line,
		Polyline,
		Rectangle,
		Polygon,
		Arc,
		Pie,
		Chord,
		Ellipse,
		Text
	};

	void initData(void* pData);

	void setShape(ShapeType shape);

	void paint(IplImage* image);

public slots:
	void fontChanged(const QFont& font);
	void penChanged(QPen& pen);
	void brushChanged(QBrush& brush);

protected:
	bool bDrawing;
	int x,y,w,h;
	void mousePressEvent(QMouseEvent *event);
	void mouseMoveEvent(QMouseEvent *event);
	void mouseReleaseEvent(QMouseEvent *event);
	void paintEvent(QPaintEvent *event);
	void resizeEvent(QResizeEvent *e);
	
private:
	IplImage*  bufferImage;
	IplImage* tempImage;
	ShapeType curShape;
	QPen curPen;
	QBrush curBrush;
	QFont textFont;
	int thickness;
	IplImage*  currentImage;
};

#endif

